package com.zkthink.ceres.pay.wechat.v3.service.ecommerce.impl;

import com.zkthink.ceres.pay.wechat.v3.http.HttpClientHelper;
import com.zkthink.ceres.pay.wechat.v3.entity.request.combine.CloseOrderRequest;
import com.zkthink.ceres.pay.wechat.v3.entity.request.combine.CombineOrderRequest;
import com.zkthink.ceres.pay.wechat.v3.entity.request.combine.NoticeOrderRequest;
import com.zkthink.ceres.pay.wechat.v3.entity.request.combine.QueryOrderRequest;
import com.zkthink.ceres.pay.wechat.v3.entity.result.combine.CloseOrderResult;
import com.zkthink.ceres.pay.wechat.v3.entity.result.combine.CombineOrderResult;
import com.zkthink.ceres.pay.wechat.v3.entity.result.combine.NoticeOrderResult;
import com.zkthink.ceres.pay.wechat.v3.entity.result.combine.QueryOrderResult;
import com.zkthink.ceres.pay.wechat.v3.service.ecommerce.CombinePayService;
import org.springframework.stereotype.Component;

/**
 * <p>
 *   合单下单-JSAPI支付API
 *   使用合单支付接口，用户只输入一次密码，即可完成多个订单的支付。目前最多一次可支持50笔订单进行合单支付。
 * </p>
 *
 * @author vivi.huang
 * @since 2020/5/17
 */
@Component
public class CombinePayServiceImpl implements CombinePayService {

    private HttpClientHelper httpClientHelper = new HttpClientHelper();

    @Override
    public CombineOrderResult createCombineOrder(CombineOrderRequest request) {
        return (CombineOrderResult) httpClientHelper.doRequest(request);
    }

    @Override
    public QueryOrderResult queryCombineOrder(QueryOrderRequest request) {
        return (QueryOrderResult) httpClientHelper.doRequest(request);
    }

    @Override
    public CloseOrderResult closeCombineOrder(CloseOrderRequest request) {
        return (CloseOrderResult) httpClientHelper.doRequest(request);
    }

    @Override
    public NoticeOrderResult noticeOrder(NoticeOrderRequest request) {
        return (NoticeOrderResult) httpClientHelper.doRequest(request);
    }
}